var o = require("./UISoundManager.js"), i = cc.Class({
    extends: cc.Component,
    properties: {},
    init: function () {
        this._isReused = !1;
    },
    initHook: function () {
        var e = Global.utils.searchNode(this.node, "mask"),
            t = Global.utils.searchNode(this.node, "Btn_Closed"),
            n = Global.utils.searchNode(this.node, "CommonPanel");
        e && e.on("touchend", this.onInterceptEvent, this), t && t.active && this.OnPanelClose && e && e.on("touchend", this.OnPanelClose, this),
        n && n.on("touchend", this.onInterceptEvent, this), tywx.NotificationCenter.trigger(tywx.EventType.MSG_SHOW_GAME_INTERACTION, !1);
    },
    OnPanelClose: function () {
        o.playEffect("select"), this.closePanel();
    },
    onDestroy: function () {
        Global.notificationCenter.offAll(this), this.onDestroyHook();
    },
    onDestroyHook: function () {
    },
    setPanelDisplay: function (e) {
        this.node ? this.node.active = e : console.warn("Access invalid compoment object!");
    },
    showPanel: function () {
        this.node ? this.node.active = !0 : console.warn("Access invalid compoment object!");
    },
    hiddenPanel: function () {
        this.node ? this.node.active = !1 : console.warn("Access invalid compoment object!");
    },
    playAimationOnLoad: function () {
        var e = Global.utils.searchComp(this.node, "Panel_root", cc.Animation);
        e && e.play();
    },
    toggleVisibility: function () {
        this.node ? this.node.active ? this.node.active = !1 : this.node.active = !0 : console.warn("Access invalid compoment object!");
    },
    visible: function () {
        if (this.node) return this.node.active;
        console.warn("Access invalid compoment object!");
    },
    reuse: function () {
        this._isReused = !0;
    },
    closePanel: function (e) {
        this._isReused ? this.hiddenPanel() : this.node ? Global.UIPopupManager.removePopup(this.node) : console.warn("Access invalid component object!"),
        e && e.stopPropagation(), this.closePanelHook();
    },
    closePanelHook: function () {
        tywx.NotificationCenter.trigger(tywx.EventType.MSG_SHOW_GAME_INTERACTION, !0);
    },
    onInterceptEvent: function (e) {
        e.stopPropagation();
    },
    initAlert: function (e, t, n, o, i, a, r, s, l, c) {
        for (var d = Global.utils.searchComp(this.node, "Lbl_Content", cc.Label), u = Global.utils.searchNode(this.node, "Btn_Confirm"), h = Global.utils.searchNode(this.node, "Btn_Cancel"), f = Global.utils.searchNode(this.node, "Btn_Closed"), p = Global.utils.searchComp(u, "Label", cc.Label), g = Global.utils.searchComp(h, "Label", cc.Label), b = Global.utils.searchComp(h, "sp", cc.Sprite), m = Global.utils.searchComp(u, "sp", cc.Sprite), _ = 0; _ < 2; _++) u.children[_].active = !1,
            h.children[_].active = !1;
        u.on("touchend", this.onConfirm, this), h.on("touchend", this.onCancel, this), f.on("touchend", this.onClose, this),
            l = void 0 == l || l, c = void 0 == c || c, d && e && (d.string = e), p && o && (m && t || (p.node.active = !0,
            p.string = o)), g && i && (b && n || (g.node.active = !0, g.string = i)), b && n && (b.node.active = !0,
            b.spriteFrame = n), m && t && (m.node.active = !0, m.spriteFrame = t), a && (this._confirmCallback = a),
        s && (this._closeCallback = s), r ? this._cancelCallback = r : h.active = !1, l || (f.active = !1),
        c || (u.active = !1);
    },
    onConfirm: function (e) {
        this.closePanel(), this._confirmCallback && this._confirmCallback(e);
    },
    onCancel: function (e) {
        this.closePanel(), this._cancelCallback && this._cancelCallback(e);
    },
    onClose: function (e) {
        this._closeCallback ? (this.closePanel(), this._closeCallback(e)) : this.onCancel(e);
    }
});
module.exports = i
